//
//  PropertyRentMoneyTableViewCell.m
//  PropertyManager
//
//  Created by 楠 on 2018/10/21.
//  Copyright © 2018年 Tng. All rights reserved.
//

#import "PropertyRentMoneyTableViewCell.h"

@implementation PropertyRentMoneyTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

-(instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self creatUI];
        self.separatorInset = UIEdgeInsetsMake(0, 15, 0, 0);
    }
    return self;
}

-(void)creatUI{
    [self.contentView addSubview:self.nameLabel];
    [self.contentView addSubview:self.phoneLabel];
    [self.contentView addSubview:self.rentMoneyLabel];
    [self.contentView addSubview:self.managerMoneyLabel];
}

-(UILabel *)nameLabel
{
    if (_nameLabel == nil) {
        _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, WIDTH/2 - 15, 20)];
        _nameLabel.font = font(14);
        _nameLabel.textColor = SFM51;
        _nameLabel.textAlignment = NSTextAlignmentLeft;
    }
    return _nameLabel;
}

-(UILabel *)phoneLabel
{
    if (_phoneLabel == nil) {
        _phoneLabel = [[UILabel alloc] initWithFrame:CGRectMake(WIDTH/2 + 10, 10, WIDTH/2 - 15, 20)];
        _phoneLabel.font = font(14);
        _phoneLabel.textColor = SFM51;
        _phoneLabel.textAlignment = NSTextAlignmentLeft;
    }
    return _phoneLabel;
}

-(UILabel *)rentMoneyLabel
{
    if (_rentMoneyLabel == nil) {
        _rentMoneyLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 35, WIDTH/2 - 15, 20)];
        _rentMoneyLabel.font = font(14);
        _rentMoneyLabel.textColor = SFM51;
        _rentMoneyLabel.textAlignment = NSTextAlignmentLeft;
    }
    return _rentMoneyLabel;
}

-(UILabel *)managerMoneyLabel
{
    if (_managerMoneyLabel == nil) {
        _managerMoneyLabel = [[UILabel alloc] initWithFrame:CGRectMake(WIDTH/2 + 10, 35, WIDTH/2 - 15, 20)];
        _managerMoneyLabel.font = font(14);
        _managerMoneyLabel.textColor = SFM51;
        _managerMoneyLabel.textAlignment = NSTextAlignmentLeft;
    }
    return _managerMoneyLabel;
}

-(void)send
{
    self.nameLabel.text = [NSString stringWithFormat:@"联系人：%@",@"李先生"];
    self.phoneLabel.text = [NSString stringWithFormat:@"联系方式：%@",@"13217786799"];
    self.rentMoneyLabel.attributedText = [NSMutableAttributedString headStr:@"月租金：" AndMiddleStr:@"¥2000" AndFootStr:@"" AndFont:font(14) AndTextColor:[UIColor redColor]];
    self.managerMoneyLabel.attributedText = [NSMutableAttributedString headStr:@"月管理费：" AndMiddleStr:@"¥100" AndFootStr:@"" AndFont:font(14) AndTextColor:[UIColor redColor]];
}

-(void)sendRentModel:(RentModel *)model
{
    self.nameLabel.text = [NSString stringWithFormat:@"联系人：%@",model.createName];
    self.phoneLabel.text = [NSString stringWithFormat:@"联系方式：%@",model.phone];
    self.rentMoneyLabel.attributedText = [NSMutableAttributedString headStr:@"月租金：" AndMiddleStr:[NSString stringWithFormat:@"¥%@",model.price] AndFootStr:@"" AndFont:font(14) AndTextColor:[UIColor redColor]];
    self.managerMoneyLabel.attributedText = [NSMutableAttributedString headStr:@"月管理费：" AndMiddleStr:[NSString stringWithFormat:@"¥%@",model.price] AndFootStr:@"" AndFont:font(14) AndTextColor:[UIColor redColor]];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
